﻿/*
 * You have to produce the following output by appropriately instantiating the available classes: 
 * "Never send a human to do a machine's job."
 */

using System;

namespace HomeTask02
{
    #region The available classes

    public interface IWord
    {
        void Print();
    }

    public interface IWord2 : IWord
    {
        new void Print();
    }

    public abstract class Base
    {
        protected static string msg = "send ";

        public Base()
        {
            Console.Write(this.GetString());
        }

        static Base()
        {
            Console.Write("Never ");
        }

        public virtual void Print()
        {
            Console.Write("to ");
        }

        protected virtual string GetString()
        {
            return "llama ";
        }
    }

    public class Derived : Base, IWord
    {

        static Derived()
        {
            Console.Write(Derived.msg);
        }

        public new virtual void Print()
        {
            Console.Write("do ");
        }

        protected override string GetString()
        {
            return "a ";
        }
    }

    public sealed class MoreDerived : Derived, IWord
    {
        public override void Print()
        {
            Console.Write("mach");
        }

        void IWord.Print()
        {
            Console.Write("a ");
        }

        protected override string GetString()
        {
            return "do ";
        }
    }

    public sealed class MoreDerived2 : Derived, IWord2
    {

        static MoreDerived2()
        {
            Console.Write("ine");
        }

        public new void Print()
        {
            Console.Write("job. ");
        }

        void IWord2.Print()
        {
            Console.Write("job.");
        }

        protected override string GetString()
        {
            return "'s ";
        }
    }

    public abstract class Unfinished : Base
    {
        protected new void Print()
        {
            Console.Write("camel ");
        }

        protected override string GetString()
        {
            return "human ";
        }
    }

    public class Finished : Unfinished
    {
    }

    #endregion

    class Program
    {

        public static void Main()
        {
            /*             
                put your code here            
            */
            Derived drv = new Derived();
            Finished fin = new Finished();

            Base bdrv = (Base)drv;
            bdrv.Print();

            MoreDerived mdrv = new MoreDerived();
            IWord imdrv = (IWord)mdrv;
            imdrv.Print();
            mdrv.Print();
            MoreDerived2 mdrv2 = new MoreDerived2();
            IWord2 imdrv2 = (IWord2)mdrv2;
            imdrv2.Print();

            Console.WriteLine("\n");
            Console.WriteLine("Never send a human to do a machine's job.");
            Console.ReadLine();
        }

    }
}
